{"ast":null,"code":"import _regeneratorRuntime from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";import _objectSpread from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import _asyncToGenerator from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";import _slicedToArray from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import React from\"react\";import{FindUsers as FindUsersList}from\"../components/\";import{UserService}from\"../services\";import{jsx as _jsx}from\"react/jsx-runtime\";var FindUsers=function FindUsers(props){var _React$useState=React.useState({items:[]}),_React$useState2=_slicedToArray(_React$useState,2),usersList=_React$useState2[0],setUsersList=_React$useState2[1];var _React$useState3=React.useState(''),_React$useState4=_slicedToArray(_React$useState3,2),inputValue=_React$useState4[0],setInputValue=_React$useState4[1];var onChangeInput=function onChangeInput(){var value=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'';if(value.length!==0){_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return UserService.FindUsers({searchValue:value}).then(function(res){if(res.status===200){setUsersList(_objectSpread(_objectSpread({},usersList),{},{items:res.data.items}));}});case 2:case\"end\":return _context.stop();}}},_callee);}))();}else{setUsersList({items:[]});}setInputValue(value);};return/*#__PURE__*/_jsx(FindUsersList,{users:usersList,onSearch:onChangeInput,inputValue:inputValue});};export default FindUsers;","map":{"version":3,"names":["React","FindUsers","FindUsersList","UserService","props","useState","items","usersList","setUsersList","inputValue","setInputValue","onChangeInput","value","length","searchValue","then","res","status","data"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/containers/FindUsers.tsx"],"sourcesContent":["import React from \"react\";\nimport {FindUsers as FindUsersList} from \"../components/\";\nimport {UsersListResponse} from \"../models/response/UsersListResponse\";\nimport {UserService} from \"../services\";\n\nconst FindUsers:React.FC = (props) => {\n    const [usersList, setUsersList] = React.useState<UsersListResponse>({items: []});\n    const [inputValue, setInputValue] = React.useState<string>('');\n\n    const onChangeInput = (value: string = '') => {\n        if (value.length !== 0) {\n            (async function() {\n                await UserService.FindUsers({searchValue: value}).then((res: any) => {\n                    if (res.status === 200) {\n                        setUsersList({\n                            ...usersList,\n                            items: res.data.items\n                        });\n                    }\n                });\n            })()\n        } else {\n            setUsersList({items: []});\n        }\n\n        setInputValue(value);\n    };\n\n    return <FindUsersList\n        users={usersList}\n        onSearch={onChangeInput}\n        inputValue={inputValue}\n    />;\n\n};\n\nexport default FindUsers;"],"mappings":"ukBAAA,MAAOA,MAAK,KAAM,OAAO,CACzB,OAAQC,SAAS,GAAIC,cAAa,KAAO,gBAAgB,CAEzD,OAAQC,WAAW,KAAO,aAAa,CAAC,2CAExC,GAAMF,UAAkB,CAAG,QAArBA,UAAkB,CAAIG,KAAK,CAAK,CAClC,oBAAkCJ,KAAK,CAACK,QAAQ,CAAoB,CAACC,KAAK,CAAE,EAAE,CAAC,CAAC,oDAAzEC,SAAS,qBAAEC,YAAY,qBAC9B,qBAAoCR,KAAK,CAACK,QAAQ,CAAS,EAAE,CAAC,qDAAvDI,UAAU,qBAAEC,aAAa,qBAEhC,GAAMC,cAAa,CAAG,QAAhBA,cAAa,EAA2B,IAAvBC,MAAa,2DAAG,EAAE,CACrC,GAAIA,KAAK,CAACC,MAAM,GAAK,CAAC,CAAE,CACpB,0DAAC,2JACSV,YAAW,CAACF,SAAS,CAAC,CAACa,WAAW,CAAEF,KAAK,CAAC,CAAC,CAACG,IAAI,CAAC,SAACC,GAAQ,CAAK,CACjE,GAAIA,GAAG,CAACC,MAAM,GAAK,GAAG,CAAE,CACpBT,YAAY,gCACLD,SAAS,MACZD,KAAK,CAAEU,GAAG,CAACE,IAAI,CAACZ,KAAK,GACvB,CACN,CACJ,CAAC,CAAC,uDACL,IAAG,CACR,CAAC,IAAM,CACHE,YAAY,CAAC,CAACF,KAAK,CAAE,EAAE,CAAC,CAAC,CAC7B,CAEAI,aAAa,CAACE,KAAK,CAAC,CACxB,CAAC,CAED,mBAAO,KAAC,aAAa,EACjB,KAAK,CAAEL,SAAU,CACjB,QAAQ,CAAEI,aAAc,CACxB,UAAU,CAAEF,UAAW,EACzB,CAEN,CAAC,CAED,cAAeR,UAAS"},"metadata":{},"sourceType":"module"}